local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
      "git",
      "clone",
      "--filter=blob:none",
      "https://github.com/folke/lazy.nvim.git",
      "--branch=stable",
      lazypath,
    })
end

vim.opt.rtp:prepend(lazypath)

-- 插件定义
local plugins = {
  {
    "nvim-tree/nvim-tree.lua",
    version = "*",
    dependencies = {"nvim-tree/nvim-web-devicons"},
    config = function()
      require("nvim-tree").setup()
    end
  },
  {
  "pmizio/typescript-tools.nvim",
  dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" },
  opts = {},
  },
  {
    "williamboman/mason.nvim",
    version = "*",
    config = function()
      require("mason").setup({
        ui = {
          package_installed = "✔",
          package_pending = "☛",
          package_uninstalled = "✘"
        }
      })
    end
  },
  {
    "williamboman/mason-lspconfig",
    version = "*",
    config = function()
      require("mason-lspconfig").setup_handlers({
        function(server_name)
          require("lspconfig")[server_name].setup({})
        end
      })
    end
  },
  {
    "akinsho/bufferline.nvim",
    version = "*",
    dependencies = {'nvim-tree/nvim-web-devicons'},
    config = function()
      require("bufferline").setup({})
    end
  },
  {
    "nvim-lualine/lualine.nvim",
    version = "*",
    dependencies = {"nvim-tree/nvim-web-devicons", opt = true},
    theme = 'tokyonight',
    config = function()
      require("lualine").setup({})
    end
  },
  {
    "utilyre/barbecue.nvim",
    name = "barbecue",
    version = "*",
    dependencies = {
      "SmiteshP/nvim-navic",
      "nvim-tree/nvim-web-devicons", -- optional dependency
    },
    theme = 'tokyonight',
    opts = {
      -- configurations go here
      offsets = {
        {
          filetype = "NvimTree",
          text = "File Explorer",
          text_align = "left",
          separator = true,
        },
      },
    }
  },
  {
    "folke/tokyonight.nvim",
    lazy = false,
    priority = 1000,
    opts = {
      transparent = true,
      styles = {
        sidebars = "transparent",
        float = "transparent"
      }
    }
  },
  {
    "nordtheme/vim",
  },
  {
    "nvim-telescope/telescope.nvim",
    tag = '0.1.5',
    dependencies = { 'nvim-lua/plenary.nvim' }
  },
  {
    "lukas-reineke/indent-blankline.nvim",
    main = "ibl",
    opts = {}
  },
  {
    "akinsho/toggleterm.nvim",
    version = "*",
    config = function()
      require('toggleterm').setup({
        open_mapping = '<C-g>',
        direction = 'float',
        shade_terminals = true
      })
    end
  },
  {
    "nvimdev/lspsaga.nvim",
    config = function()
      local saga = require('lspsaga')
      saga.setup({})
    end,
    dependencies = {
      'nvim-treesitter/nvim-treesitter', -- optional
      'nvim-tree/nvim-web-devicons'     -- optional
    }
  },
  {
    'brenoprata10/nvim-highlight-colors',
    config = function()
      require("nvim-highlight-colors").setup({
        enable_tailwind = true,
      })
    end
  },
  {
    'nvim-treesitter/nvim-treesitter',
    config = function()
      require('nvim-treesitter.configs').setup({
        ensure_installed = {
          "c", "lua", "vim", "vimdoc", "query", "html", "css", "javascript",
          "json", "python", "rust", "scss"
        },
        sync_install = false,
        auto_install = true,
        highlight = {
          enable = true,
          additional_vim_regex_highlighting = false,
        }
      })
    end
  },
  {
    "kylechui/nvim-surround",
    version = "*",
    event = "VeryLazy",
    config = function()
      require("nvim-surround").setup({})
    end
  },
  {
    'Wansmer/treesj',
    keys = { '<space>m', '<space>j', '<space>s' },
    dependencies = { 'nvim-treesitter/nvim-treesitter' },
    config = function()
      require('treesj').setup({})
    end
  },
  {
    "folke/trouble.nvim",
    dependencies = { "nvim-tree/nvim-web-devicons" },
    opts = {}
  },
  {
    "f-person/git-blame.nvim",
    config = function()
      require('gitblame').setup({})
    end
  },
  {
    'numToStr/Comment.nvim',
    opts = {
        -- add any options here
    }
  },
  "neovim/nvim-lspconfig",
  "hrsh7th/nvim-cmp",
  "hrsh7th/cmp-nvim-lsp",
  "L3MON4D3/LuaSnip",
  "saadparwaiz1/cmp_luasnip",
  "rafamadriz/friendly-snippets",
  "hrsh7th/cmp-path",
  "jiangmiao/auto-pairs",
}

-- 初始化 lazy.nvim
require('lazy').setup(plugins, opt)

